/* markdownItDataset 插件相关样式 */

/* 数据集样式 */
.dataset-container {
  border: 1px solid var(--md-dataset-border);
  border-radius: 6px;
  margin: 1em 0;
  background: var(--md-dataset-bg);
}

.dataset-header {
  padding: 0.5em 0.75em;
  margin-bottom: 0;
  cursor: pointer;
  transition: background-color 0.2s ease;
  user-select: none;
}

/* 只在展开时显示底部边框 */
.dataset-header.expanded {
  border-bottom: 1px solid #e1e4e8;
}

.dataset-header:hover {
  background-color: var(--md-dataset-header-hover);
}

.dataset-header.expanded {
  border-bottom: 1px solid var(--md-dataset-border);
}

.dataset-header-content {
  display: flex;
  align-items: center;
  gap: 0.5em;
}

.dataset-toggle-icon {
  font-size: 10px;
  transition: transform 0.2s ease;
  display: inline-block;
  width: 14px;
  text-align: center;
}

.dataset-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.dataset-title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--md-text-tertiary);
}

.dataset-id {
  font-size: 11px;
  color: var(--md-dataset-id-text);
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  background: var(--md-dataset-id-bg);
  padding: 0.2em 0.4em;
  border-radius: 3px;
}

.dataset-info {
  font-size: 11px;
  color: var(--md-text-secondary);
  margin-left: auto;
}

.dataset-toggle-icon,
.dataset-icon {
  color: var(--md-text-secondary);
  fill: var(--md-text-secondary);
}

.dataset-content {
  padding: 1em;
}

.dataset-filters {
  margin-bottom: 1em;
}

.filter-section {
  margin-bottom: 0;
}

.filter-section label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 0.5em;
  color: var(--md-text-tertiary);
}

.field-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
}

.filter-checkbox {
  display: flex;
  align-items: center;
  font-size: 12px;
  color: var(--md-text-secondary);
  cursor: pointer;
}

.filter-checkbox input {
  margin-right: 0.25em;
}

.data-filters {
  display: flex;
  flex-direction: column;
  gap: 0.5em;
}

.condition-builder {
  display: flex;
  gap: 0.25em;
  align-items: center;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding: 0.25em;
  background: var(--md-condition-builder-bg);
  border-radius: 4px;
  border: none;
}

.condition-field,
.condition-operator {
  padding: 0.25em 0.5em;
  border: 1px solid var(--md-input-border);
  border-radius: 3px;
  font-size: 11px;
  height: 24px;
  line-height: 1;
  box-sizing: border-box;
  background: var(--md-input-bg);
  color: var(--md-input-text);
  min-width: 80px;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=US-ASCII,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'><path fill='%23666' d='M2 0L0 2h4zm0 5L0 3h4z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.25em center;
  background-size: 0.5em;
  padding-right: 1.5em;
  cursor: pointer;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.condition-field:hover,
.condition-operator:hover {
  border-color: var(--md-input-hover-border);
}

.condition-field:focus,
.condition-operator:focus {
  outline: none;
  border-color: var(--md-input-focus-border);
  box-shadow: 0 0 0 1px var(--md-input-focus-shadow);
}

.condition-value {
  padding: 0.25em 0.5em;
  border: 1px solid var(--md-input-border);
  border-radius: 3px;
  font-size: 11px;
  height: 24px;
  line-height: 1;
  box-sizing: border-box;
  background: var(--md-input-bg);
  color: var(--md-input-text);
  min-width: 80px;
  flex: 1;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.condition-value:hover {
  border-color: var(--md-input-hover-border);
}

.condition-value:focus {
  outline: none;
  border-color: var(--md-input-focus-border);
  box-shadow: 0 0 0 1px var(--md-input-focus-shadow);
}

.condition-add-btn,
.action-btn {
  padding: 0.25em 0.75em;
  border: 1px solid var(--md-button-border);
  border-radius: 3px;
  background: var(--md-button-bg);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  height: 24px;
  line-height: 1;
  color: var(--md-button-text);
  transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
}

.condition-add-btn:hover,
.action-btn:hover {
  background: var(--md-button-bg-hover);
}

.condition-add-btn {
  background: var(--md-button-bg-active);
  border-color: var(--md-button-bg-active);
  color: white;
  font-weight: 500;
}

.condition-add-btn:hover {
  background: var(--md-button-bg-active);
  border-color: var(--md-button-bg-active);
  opacity: 0.9;
}

.condition-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
  min-height: 24px;
}

.condition-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25em;
  padding: 0.25em 0.5em;
  background: var(--md-tag-bg);
  border-radius: 3px;
  font-size: 12px;
  color: var(--md-tag-text);
}

.condition-tag-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--md-tag-remove-color);
  font-size: 12px;
  padding: 0;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
}

.condition-tag-remove:hover {
  background: var(--md-tag-remove-hover-bg);
  color: var(--md-tag-text);
}

.filter-actions {
  display: flex;
  gap: 0.5em;
  align-items: center;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 0.25em 0.75em;
  border: 1px solid var(--md-button-border);
  border-radius: 3px;
  background: var(--md-button-bg);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  height: 24px;
  line-height: 1;
  color: var(--md-button-text);
}

.filter-btn:hover {
  background: var(--md-button-bg-hover);
}


.preview-table-container {
  max-height: 200px;
  overflow: auto;
  border: none;
}

.preview-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.preview-table th,
.preview-table td {
  text-align: left;
  word-wrap: break-word;
}

.dataset-error {
  padding: 1em;
  background: var(--md-error-bg);
  border: 1px solid var(--md-error-border);
  border-radius: 4px;
  color: var(--md-error-text);
  margin: 0.5em 0;
}


/* 分页样式 */
.dataset-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1em;
  margin-top: 0.5em;
  padding: 0;
  background: transparent;
  border: none;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.pagination-info {
  font-size: 12px;
  color: var(--md-text-secondary);
  flex-shrink: 0;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 0.5em;
  flex-shrink: 0;
}

.pagination-btn {
  padding: 0.25em 0.75em;
  border: 1px solid var(--md-button-border);
  border-radius: 3px;
  background: var(--md-button-bg);
  font-size: 12px;
  cursor: pointer;
  color: var(--md-button-text);
  height: 24px;
  line-height: 1;
  transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
}

.pagination-btn:hover:not(:disabled) {
  background: var(--md-button-bg-hover);
}

.pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination-btn.active {
  background: var(--md-button-bg-active);
  border-color: var(--md-button-bg-active);
  color: white;
}

.pagination-pages {
  display: flex;
  align-items: center;
  gap: 0.25em;
}

.pagination-page {
  padding: 0.25em 0.5em;
  border: 1px solid var(--md-button-border);
  border-radius: 3px;
  background: var(--md-button-bg);
  font-size: 12px;
  cursor: pointer;
  color: var(--md-button-text);
  height: 24px;
  line-height: 1;
  min-width: 24px;
  text-align: center;
}

.pagination-page:hover {
  background: var(--md-button-bg-hover);
}

.pagination-page.active {
  background: var(--md-button-bg-active);
  border-color: var(--md-button-bg-active);
  color: white;
}

/* 每页显示数量样式 */
.pagination-size {
  display: flex;
  align-items: center;
  gap: 0.5em;
  font-size: 12px;
  color: var(--md-text-secondary);
  flex-shrink: 0;
}

.page-size-select {
  padding: 0.25em 0.5em;
  border: 1px solid var(--md-button-border);
  border-radius: 3px;
  background: var(--md-button-bg);
  font-size: 12px;
  color: var(--md-button-text);
  height: 24px;
  line-height: 1;
  cursor: pointer;
}

.page-size-select:hover {
  background: var(--md-button-bg-hover);
}

.page-size-select:focus {
  outline: none;
  border-color: var(--md-input-focus-border);
  box-shadow: 0 0 0 2px var(--md-input-focus-shadow);
}
